package com.cqust.icc;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

/**
 * @author 张成
 * @version 1.0
 * @date 2022/4/1 9:54
 */

public class TransactionTest {


    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("classpath:applicationContext.xml");

        AccountDao accountDao = (AccountDao) context.getBean("accountDao");
        accountDao.addAccount(new Account("zcc","50"));
        accountDao.updateAccount(new Account("zcc","30"));
        accountDao.deleteAccountById(1);
        List<Account> accountList = accountDao.selectAllAccountList();
        System.out.println(accountList);


        System.out.println("--- 开户 ---");
        accountDao.addAccount(new Account("wdm","999"));

        System.out.println("--- 取款 ---");
        accountDao.withdrawMoney(new Account("wdm","111"));
        System.out.println("--- 查询 ---");
        List<Account> accountList1 = accountDao.selectAllAccountList();
        System.out.println(accountList1);
        System.out.println("--- 转账 ---");
        accountDao.Transfer(new Account("wdm"),new Account("zcc"),"1314");

    }


}
